#include <sstream>
#include "mh_mcu.h"
#include "DragonBall_external_board.h"
#include "optiga_host.h"


namespace igslib
{
    IExternalBoardManager* CExternalBoardManager::instance = 0;
    IExternalBoardManager* CExternalBoardManager::GetInstance() 
    {
        if ( instance == 0 )
        {
            instance = new CExternalBoardManager();
        }
        return instance ;
    }
    IExternalBoard* CExternalBoardManager::New_MH_MCU()
    {
        IExternalBoard* rtn = nullptr;
        try
        {
            rtn = new mh_mcu();
            cpns.insert(rtn);
        }
        catch(const std::exception&)
        {
        }
        return rtn;
    }
    IExternalBoard* CExternalBoardManager::New_ProjMCU(const std::string& proj_name)
    {
        IExternalBoard* rtn = nullptr;
        if (proj_name == "DragonBallRace")
        {
            rtn = new DragonBall_externalboard();
            cpns.insert(rtn);
        }
        return rtn;
    }
}

extern "C"
{
    igslib::IExternalBoardManager* GetExternalBoardManagerInstance()
    {
        igslib::IExternalBoardManager* rtn = NULL;
        rtn = igslib::CExternalBoardManager::GetInstance();
        return rtn;
    }
}
